<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>{$site_name}-后台管理</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="{:_static()}/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="{:_static()}/css/user.css" media="all" />
	<link rel="stylesheet" href="{:_static()}/css/common.css" media="all" />
</head>
<body class="childrenBody">
	<form class="layui-form">
		<input type="hidden" value="{$id}" name="id" />
		<div class="p_x20">
			<div class="layui-form-item">
			    <label class="layui-form-label">昵称</label>
			    <div class="layui-input-block">
			    	<input type="text" name="name" {notempty name="$software"}value="{$software.name}"{/notempty} placeholder="设配昵称" class="layui-input">
			    </div>
			</div>
			<div class="layui-form-item">
			    <label class="layui-form-label must">号码</label>
			    <div class="layui-input-block">
					<!-- {notempty name="$software"} -->
					<input type="text" name="number" value="{$software.number}" class="layui-input" placeholder="例：微信号">
					<!-- {else/} -->
					<input type="text" name="number" class="layui-input" placeholder="例：微信号">
					<!-- {/notempty} -->
				</div>
			</div>
			<div class="layui-form-item" pane="">
			    <label class="layui-form-label must">所属类型</label>
			    <div class="layui-input-block ">
					<select name="type_id" lay-verify="required">
						<!-- {foreach $type as $v} -->
				        <option value="{$v.id}" {if(isset($software['type_id'])&&$software['type_id']==$v['id'])} selected {/if}>{$v.name}</option>
						<!-- {/foreach} -->
				    </select>
			    </div>
			</div>
			<div class="layui-form-item" pane="">
			    <label class="layui-form-label must">所属设备</label>
			    <div class="layui-input-block ">
					<select name="device_id" lay-verify="required">
				        <option value=""></option>
						<!-- {foreach $device as $v} -->
					        <option value="{$v.id}" {if(isset($software['device_id'])&&$software['device_id']==$v['id'])} selected {/if}>{$v.name}</option>
						<!-- {/foreach} -->
				    </select>
			    </div>
			</div>
			<div class="layui-form-item" pane="">
			    <label class="layui-form-label">性别</label>
			    <div class="layui-input-block ">
			    	<input type="radio" name="sex" value="1" title="男" {if(isset($software['sex'])&&$software['sex']==1)} checked {/if}>
	     			<input type="radio" name="sex" value="0" title="女" {if(isset($software['sex'])&&$software['sex']==0)} checked {/if}>
	     			<input type="radio" name="sex" value="2" title="保密"  {if(empty($software['sex'])||$software['sex']==2)} checked {/if}>
			    </div>
			</div>
			<div class="layui-form-item">
			    <label class="layui-form-label must">登录名</label>
			    <div class="layui-input-block">
			    	<input type="text" name="login_name" {notempty name="$software"}value="{$software.login_name}"{/notempty} placeholder="版本号"class="layui-input ">
			    </div>
			</div>
			<div class="layui-form-item">
			    <label class="layui-form-label must">登录密码</label>
			    <div class="layui-input-block">
			    	<input type="text" name="login_pwd" {notempty name="$software"}value="{$software.login_pwd}"{/notempty} placeholder="手机UDID" class="layui-input ">
			    </div>
			</div>
			<div class="layui-form-item">
			    <label class="layui-form-label">手机号码</label>
			    <div class="layui-input-block">
			    	<input type="tel" name="tel" {notempty name="$software"}value="{$software.tel}"{/notempty} placeholder="手机号码" class="layui-input userPhone">
			    </div>
			</div>
			<div class="layui-form-item">
			    <label class="layui-form-label">备注</label>
			    <div class="layui-input-block">
					<textarea name="remark" class="layui-textarea" placeholder="说明备注信息">
						{notempty name="$software"}{$software.remark}{/notempty}
					</textarea>
			    </div>
			</div>
			<div class="layui-form-item" style="margin-left: 5%;">
			    <div class="layui-input-block">
			    	<button class="layui-btn" lay-submit="" lay-filter="add">立即提交</button>
			    </div>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="{:_static()}/layui/layui.js"></script>
	<script type="text/babel" src="{:_static()}/js/common.js"></script>
</body>
</html>
<script type="text/babel" type="text/javascript">
layui.config({
	//base : "js/"
}).use(['form','layer'],function(){
	form = layui.form();
	let layer = parent.layer === undefined ? layui.layer : parent.layer;
		$ = layui.jquery;
		$form = $('form');
	//提交个人资料
	form.on("submit(add)",function(data){
		$.post("{:url('')}",data.field,function(rs){
			util.o(rs,true).then(_=>{
				parent.location.reload(true);
			});
		})
		return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
	})

})
</script>
